package com.iflytek.sort;

import org.apache.hadoop.io.LongWritable;
import org.apache.hadoop.io.Text;
import org.apache.hadoop.mapreduce.Mapper;

import java.io.IOException;

public class BestSortSumMapper extends Mapper<LongWritable, Text, BestCountBean,Text> {

    BestCountBean outKey = new BestCountBean();
    Text outValue = new Text();

    @Override
    protected void map(LongWritable key, Text value, Context context) throws IOException, InterruptedException {
        String[] fields = value.toString().split("\t");
        
        outKey.setComments(Long.parseLong(fields[1]));
        outKey.setPrices(Long.parseLong(fields[2]));
        
        outValue.set(fields[0]);
        context.write(outKey,outValue);
    }
}